<template>
  <div id="navBar" class="navBar">
    <a @click="logout">
      <svg-icon icon-class="logout"></svg-icon>
    </a>
  </div>
</template>

<script>
export default {
  name: 'navBar',
  methods: {
    logout() {
      this.$store
        .dispatch('user/logout')
        .then(() => {
          this.$router.push({ path: '/login' })
        })
        .catch(() => {})
    },
  },
}
</script>

<style lang="scss" scoped>
.navBar {
  padding: 16px;
  text-align: right;
  a {
    font-weight: bold;
    color: #2c3e50;
  }
  a.router-link-exact-active {
    color: #42b983;
  }
}
</style>
